/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.pima.gestrest.model;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
import javax.persistence.Transient;

/**
 *
 * @author Pierre-Louis Conte
 */

@Entity
@NamedQuery(name = Prix.FIND_ALL, query = "SELECT b FROM Prix b")

public class Prix implements Serializable {

   public final static String FIND_ALL = "Prix.findAll";
   public final static String Del_SOM = "Prix.delete";

  @Id
    @GeneratedValue
    private Long id;
    @Column(length = 100)
    private String title;
    @Column(length = 1000)
    private String description;

    @Transient
    private Boolean selected;

    public Prix () {
    }

    public Prix(String titre, String description) {
        this.title = titre;
        this.description = description;
    }

    // ======================================
    // =          Getters & Setters         =
    // ======================================
    public String getDescription() {
        return description;
    }

    public Long getId() {
        return id;
    }

    public Boolean getSelected() {
        return selected;
    }

    public String getTitle() {
        return title;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public void setSelected(Boolean selected) {
        this.selected = selected;
    }

    public void setTitle(String titre) {
        this.title = titre;
    }

     public Boolean isSelected() {
        return selected;
    }
    // ======================================
    // =         hash, equals, toString     =
    // ======================================

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder();
        sb.append("Prix");
        sb.append("{id=").append(id);
        sb.append(", title='").append(title).append('\'');
        sb.append(", description='").append(description).append('\'');
        sb.append('}');
        return sb.toString();
    }

    @Override
    public boolean equals(Object obj) {
       if(((Prix)obj).getTitle().equals(title) && ((Prix)obj).getId().equals(id))
            return true;
        else
            return false;
    }
}
